package com.SouthernWall_404.Age_Capitalism.common.Init;

import com.SouthernWall_404.Age_Capitalism.AgeCapitalism;
import com.SouthernWall_404.Age_Capitalism.common.World.Items.MoneyItem;
import com.SouthernWall_404.Age_Capitalism.common.World.Items.StoreKeyItem;
import com.SouthernWall_404.Age_Capitalism.common.World.Items.StoreTagItem;
import com.SouthernWall_404.Age_Capitalism.common.World.Items.WalletItem;
import com.google.common.collect.Sets;
import net.minecraft.ChatFormatting;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.function.Supplier;

public class ModItems {

    public static final DeferredRegister<Item> ITEMS=DeferredRegister.create(Registries.ITEM, AgeCapitalism.MODID);
    public static LinkedHashSet<RegistryObject<Item>> CREATIVE_TAB_ITEMS = Sets.newLinkedHashSet();

    public static String TOOLTIP="tooltip."+AgeCapitalism.MODID+".";


    public static RegistryObject<Item> registerWithTab(final String name, final Supplier<Item> supplier) {
        RegistryObject<Item> item = ITEMS.register(name, supplier);
        CREATIVE_TAB_ITEMS.add(item);
        return item;
    }
    public static final RegistryObject<Item> WALLET =registerWithTab("wallet",
            ()->new WalletItem(
                    new Item.Properties()
                            .rarity(Rarity.UNCOMMON)
                            .stacksTo(1)
                            .fireResistant(),
                    20
                    )
            );
    public static final RegistryObject<Item> COIN_1 =registerWithTab("coin_1",
            ()->new MoneyItem(
                    new Item.Properties()
                            .rarity(Rarity.COMMON)
                            .stacksTo(64)
                            .fireResistant(),
                    1f,
                    List.of(Component.translatable(TOOLTIP+"coin_1.1").withStyle(ChatFormatting.GRAY)))
    );

    public static final RegistryObject<Item> COIN_2 =registerWithTab("coin_2",
            ()->new MoneyItem(
                    new Item.Properties()
                            .rarity(Rarity.RARE)
                            .stacksTo(64)
                            .fireResistant(),
                    16f,
                    List.of(Component.translatable(TOOLTIP+"coin_1.2").withStyle(ChatFormatting.GRAY)))
    );

    public static final RegistryObject<Item> COIN_3 =registerWithTab("coin_3",
            ()->new MoneyItem(
                    new Item.Properties()
                            .rarity(Rarity.UNCOMMON)
                            .stacksTo(64)
                            .fireResistant(),
                    256f,
                    List.of(Component.translatable(TOOLTIP+"coin_1.3").withStyle(ChatFormatting.GRAY)))
    );


    public static final RegistryObject<Item> STORE_TAG=registerWithTab("store_tag",
            ()->new StoreTagItem(
                    new Item.Properties()
                            .stacksTo(64)
            ));
    public static final RegistryObject<Item> STORE_KEY=registerWithTab("store_key",
            ()->new StoreKeyItem(
                    new Item.Properties()
                            .stacksTo(1)
                            .rarity(Rarity.UNCOMMON)
            )
    );

    public static final RegistryObject<Item> STORE_BLOCK_ITEM=registerWithTab("store_block",
            ()-> new BlockItem(ModBlocks.STORE_BLOCK.get(),
                    new Item.Properties()
                            .rarity(Rarity.COMMON)

            ));





}
